http://<host>:<port>/rest/managed-components/api
The portal provides a REST API to portal entities like Sites, Pages, and Navigation. All data is sent and received as JSON.
There are two base URL's for the REST API. One that will be used if you need to authenticate and one that can be used to access resources anonymously.
http://<host>:<port>/rest/managed-components/api
http://<host>:<port>/rest/private/managed-components/api
The REST API supports basic authentication. Below is an example of using basic auth in curl
curl -u <username> http://<host>:<port>/rest/private/managed-components/api
This allows users to access resources they have access to depending on the portal entity permissions.
Only members of the group /platform/administrators are allowed to add, update, or delete resources.
Since all data is sent and received as JSON, appropriate HTTP headers need to be included in each HTTP request.
For clients receiving data the following HTTP header needs to be included in the request
Accept: application/json
For clients sending data the following HTTP header needs to be included in the request
Content-Type: application/json
Localization is supported for navigation nodes who have localized displayNames. To specify the language simply add the Accept-Language header to the HTTP request. For example for French you would have the following header
Accept-Language: fr
Below are the list of resources that are available in the REST API. All URL's below are relative to the base URL explained above.
Sites are organized by site type, where site-type can be site, space, or dashboard.
GET /api/{site-type}s/
Note the 's' at the end of the URL. So space is /api/spaces/ and dashboard is /api/dashboards/
Parameter |
Type |
Default |
Description |
emptySites |
boolean |
false |
Indicates to include empty sites (sites w/out pages or navigation) |
offset |
int |
0 |
The offset of the results in a paginated request |
limit |
int |
15 |
The maximum number of results to return in a paginated request |
Below is an example that would list sites that have a siteType of 'site'.
GET /api/sites
HTTP/1.1 200 OK Content-Type: application/json [ { "name" : "classic", "type" : "site", "url" : "/api/sites/classic" }, { "name" : "mobile", "type" : "site", "url" : "/api/sites/mobile" } ]
Most responses include a url element which links to additional resources. The example above lists the sites that are available and their corresponding resource location. This should be used by clients instead of hard coding every location/url.
The url element is the full URL but for sake of brevity it's relative for the examples in this document.
To retrieve a site named site-name
GET /api/{site-type}s/{site-name}
Below is an example of retrieving the site classic.
GET /api/sites/classic
HTTP/1.1 200 OK Content-Type: application/json { "name" : "classic", "type" : "site", "displayName" : "Classic", "description" : "GateIn default portal", "skin" : "Default", "locale" : "en", "access-permissions" : ["Everyone"], "edit-permissions" : ["*:/platform/administrators"], "attributes" : [ { "key" : "showPortletInfo", "value" : "false" }, { "key" : "sessionAlive", "value" : "onDemand" } ], "pages" : {"url" : "/api/sites/classic/pages"}, "navigation" : {"url" : "/api/sites/classic/navigation"} }
To create a site named site-name
POST /api/{site-type}s/{site-name}
Below is an example of creating a site named 'foo'.
POST /api/sites/foo
HTTP/1.1 200 OK Content-Type: application/json { "name" : "foo", "type" : "site", "displayName" : "Basic Portal", "description" : "This is basic portal template", "skin" : "Default", "locale" : "en", "access-permissions" : ["Everyone"], "edit-permissions" : ["*:/platform/administrators"], "attributes" : [{ "key" : "sessionAlive", "value" : "onDemand" }], "pages" : {"url" : "/api/sites/foo/pages"}, "navigation" : {"url" : "/api/sites/foo/navigation"} }
To delete a site named site-name
DELETE /api/{site-type}s/{site-name}
Below is an example of deleting a site named 'foo'
DELETE /api/sites/foo
HTTP/1.1 200 OK Content-Type: application/json
To update a site named site-name
PUT /api/{site-type}s/{site-name}
Below is an example of updating the site 'classic' with a new description.
PUT /api/sites/classic Content-Type: application/json { "description" : "Look ma, I updated the description !" }
HTTP/1.1 200 OK Content-Type: application/json { "name" : "classic", "type" : "site", "displayName" : "Classic", "description" : "Look ma, I updated the description !", "skin" : "Default", "locale" : "en", "access-permissions" : ["Everyone"], "edit-permissions" : ["*:/platform/administrators"], "attributes" : [ { "key" : "showPortletInfo", "value" : "false" }, { "key" : "sessionAlive", "value" : "onDemand" } ], "pages" : {"url" : "/api/sites/classic/pages"}, "navigation" : {"url" : "/api/sites/classic/navigation"} }
GET /api/{site-type}s/{site-name}/pages
Parameter |
Type |
Default |
Description |
offset |
int |
0 |
The offset of the results in a paginated request |
limit |
int |
15 |
The maximum number of results to return in a paginated request |
Below is an example of listing all the pages for the site 'classic'.
GET /api/sites/classic/pages
HTTP/1.1 200 OK Content-Type: application/json [ { "name" : "homepage", "siteType" : "site", "siteName" : "classic", "url" : "/api/sites/classic/pages/homepage" }, { "name" : "register", "siteType" : "site", "siteName" : "classic", "url" : "/api/sites/classic/pages/register" }, { "name" : "sitemap", "siteType" : "site", "siteName" : "classic", "url" : "/api/sites/classic/pages/sitemap" } ]
To retrieve a page named page-name
GET /api/{site-type}s/{site-name}/pages/{page-name}
Below is an example of retrieving the page 'homepage'
GET /api/sites/classic/pages/homepage
HTTP/1.1 200 OK Content-Type: application/json { "name" : "homepage", "displayName" : "Home Page", "description" : null, "access-permissions" : ["Everyone"], "edit-permissions" : ["*:/platform/administrators"] }
To create a page named page-name
POST /api/{site-type}s/{site-name}/pages/{page-name}
Below is an example of creating a page 'newpage'
POST /api/sites/classic/pages/newpage
HTTP/1.1 200 OK Content-Type: application/json { "name" : "newpage", "displayName" : "newpage", "description" : null, "access-permissions" : ["Everyone"], "edit-permissions" : ["*:/platform/administrators"] }
To delete a page named page-name
DELETE /api/{site-type}s/{site-name}/pages/{page-name}
Below is an example of deleting a page 'newpage'
DELETE /api/sites/classic/pages/newpage
HTTP/1.1 200 OK Content-Type: application/json
To update a page named page-name
PUT /api/{site-type}s/{site-name}/pages/{page-name}
Below is an example of updating the page 'homepage' with a new description
PUT /api/sites/classic/pages/homepage Content-Type: application/json { "description" : "Look ma, I updated the description !" }
HTTP/1.1 200 OK Content-Type: application/json { "name" : "homepage", "displayName" : "Home Page", "description" : "Look ma, I updated the description !", "access-permissions" : ["Everyone"], "edit-permissions" : ["*:/platform/administrators"] }